$(document).ready(function() {   
    $("#region").wscombo({
    	width:120,
    	onselect:function( item ) { applyProvinces(item.value) }
    });
	$("#province").wscombo({
		width:120,
		onselect: function( item ) {
		    applySevenDaysForecastByProvince( item.value, item.text );
		}
	});
	$("#quick-link").hover(
	  function () {
		$("#panel").slideToggle("slow");
	  },
	  function () {
		$("#panel").slideToggle("slow");
	  }
	);
	$("#box-main-weather-left ul li:last-child").css("border", "none");
	$("#tabbed-nav").zozoTabs({
        theme: "white",      
		position: "top-compact",
        animation: {
            duration: 300,
            effects: "slideH"
        }
    });
	$("#tabbed-nav ul.z-tabs-nav.z-tabs-desktop li").css("float", "");
	$('.delayload').css("display", "block");
	
	$('.weather-link').click(function() {
		var id = $(this).attr('id');
		jQuery.ajax({
			url: "box-home-weather.php",
			type: "POST",
			dataType: "html",
			data: jQuery.param({wID: $(this).attr('id')}),
			success: function(data) {
				$("#box-main-weather-right .delayload").html(data);
				$("#tabbed-nav").zozoTabs({
					theme: "white",      
					position: "top-compact",
					animation: {
						duration: 300,
						effects: "slideH"
					}
				});
				$("#tabbed-nav ul.z-tabs-nav.z-tabs-desktop li").css("float", "");
				$('.delayload').css("display", "block");
				$('#nav-w1,#nav-w2,#nav-w3,#nav-w4,#nav-w5').removeClass('active');
				$('#nav-' + id).addClass('active');
			}
    	});
	});
	
	$('#scroll1').scroller({});
	
	$("#tabbed-career").zozoTabs({
        theme: "blue",      
		position: "top-compact",
		shadows: false,
		autoContentHeight:true,
		size: "small",
        animation: {
            duration: 300,
            effects: "slideH"
        }
    });
	
	$("#tc1").css("width","88px");
	$("#tc2").css("width","211px");
	
	$("#tabbed-sub-weather").zozoTabs({
        theme: "blue",      
		position: "top-compact",
		shadows: false,
		autoContentHeight:true,
		size: "small",
        animation: {
            duration: 300,
            effects: "slideH"
        }
    });
	
	$('.carousel').elegantcarousel({
		delay:300,
		slide:800,
		effect:'slide',		  			//  fade, slide			  
		orientation:'horizontal',		//	horizontal, vertical
		loop: true,					//	false, true
		autoplay: false,					// 	false, true
		time: 4000,
		stopAutoplay: false
	});
	
	$('.slide-link').click(function() {
		var id = $(this).attr('id');
		jQuery.ajax({
			url: "box-footer-slide.php",
			type: "POST",
			dataType: "html",
			data: jQuery.param({slID: $(this).attr('id')}),
			success: function(data) {
				$("#footer-slide .delayload").html(data);
				$('.carousel').elegantcarousel({
					delay:300,
					slide:800,
					effect:'slide',		  			//  fade, slide			  
					orientation:'horizontal',		//	horizontal, vertical
					loop: true,					//	false, true
					autoplay: false,					// 	false, true
					time: 4000,
					stopAutoplay: false
				});
				$('.delayload').css("display", "block");
				$('#nav-slide-sl1,#nav-slide-sl2,#nav-slide-sl3').removeClass('active');
				$('#nav-slide-' + id).addClass('active');
			}
    	});
	});
	
	$('#weather-left-nav').jAccordion({
		headers : ' > a',
		vertical : true,
		activeSlideAutoHeight : true,
		inactiveSlideSize : 31,
		responsive : false,
		//defaultActiveSlideIdx : 1,
		activeSlideClass : 'activeItem',
		preloadImages : false
	}).find('li ul li').click(function() {	/* Activate submenu item onClick */
		/* Remove previously activated submenu item if there is one */
		$(this).closest('.jAccordion-slidesWrapper').find('li ul li.activeSub').removeClass('activeSub');
		$(this).addClass('activeSub');	/* Activate clicked submenu item */
	});
	
	$('.verticalNav').jAccordion({
		headers : ' > a',
		vertical : true,
		activeSlideAutoHeight : true,
		inactiveSlideSize : 31,
		responsive : false,
		//defaultActiveSlideIdx : 0,
		activeSlideClass : 'activeItem',
		preloadImages : false
	}).find('li ul li').click(function() {	/* Activate submenu item onClick */
		/* Remove previously activated submenu item if there is one */
		$(this).closest('.jAccordion-slidesWrapper').find('li ul li.activeSub').removeClass('activeSub');
		$(this).addClass('activeSub');	/* Activate clicked submenu item */
	});
	
	$("#inner-tab").cleanTabs({
		"speed": 600
	});
	
	$(".sel").jqTransform();

});